<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>项目1-3的小综合</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="general-demo">
    <input type="text" v-model="name">
    <span>{{name}}</span>
    <button v-on:click="add">添加</button>
    <ul>
        <li v-for="(value,index) in arr">
            {{index}}:{{value}}
        </li>
    </ul>
    <ul>
        <li v-for="(value,key) in object">
            {{key}}:{{value}}
        </li>
    </ul>
</div>
<script type="text/javascript">
    var generalDemo=new Vue({
        el:"#general-demo",
        data:{
            name:"",
            arr:["腾讯","阿里","百度"],
            object:{
                name:"王者荣耀",
                url:"https://pvp.qq.com/",
                user:"9535万"
            }
        },
        methods:{
            add:function () {
                generalDemo.arr.push(generalDemo.name)
            },
            /*addObject:function () {
                generalDemo.object.push(generalDemo.name)
            }*/
        }
    })
</script>
</body>
</html>